import type { DictOptionItem } from '../dict-option/helper'

export interface Enterprise {
  id?: number
  enterpriseName: string
  principalType: number | null
  industry: number | null
  address: string
  registrationDate: Date
}

export interface EnterpriseStore {
  // 企业信息列表
  enterpriseList: Array<Enterprise>
  isLoading: boolean
  totalCount: number
  pageCountList: Array<number>
  pageCount: number
  currentPage: number
  queryConditions: { [key: string]: DictOptionItem }
  showSearchBar: boolean
}

/**
 * 设置默认配置
 * @return 默认配置对象
 */
export const handleDefaultSetting = (): EnterpriseStore => {
  return {
    enterpriseList: [],
    isLoading: false,
    totalCount: 0,
    pageCountList: [10, 20, 50, 100],
    pageCount: 10, // 默认页面只能显示10条
    currentPage: 1, // 当前页
    queryConditions: {}, // 搜索条件列表
    showSearchBar: true // 显示搜索栏
  }
}
